<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title><?php echo C("SITE_NAME");?>管理后台</title>
<link rel="shortcut icon" href=" /favicon.ico" />
<link rel="stylesheet" href="/Static/admin/css/component-min.css">
<link rel="stylesheet" href="/Static/admin/css/home.2015.05.22-09.32.css">
<link rel="stylesheet" href="/Static/admin/icon/iconfont.css">
<!--弹窗-->
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script src="/Static/admin/js/layer-2.x/layer.js?v=1.9.0"></script>
<script src="/Static/admin/js/common.js"></script>
<script>
	var UPYUN_DOMAIN = '<?php echo C("UPYUN_DOMAIN");?>';
</script>
</head>
<body class="cp-bodybox">
<!--[if lt IE 9]>
<div class="alert alert-danger disable-del txtCenter" id="tipLowIEVer">
    <h4>系统检测到您使用的浏览器版本过低，为达到更好的体验效果请升级您的浏览器，我们为您推荐：</h4>
    <p>
        <a href="http://www.firefox.com.cn/download/" target="_blank">Firefox浏览器</a>
        <a href="http://www.maxthon.cn/" target="_blank">遨游浏览器</a>
        <a href="http://se.360.cn/" target="_blank">360浏览器</a>
    </p>
</div>
<![endif]-->
<style>
.header-nav-list a {
  display: block;
  padding: 0 10px;
  min-width: 70px;
  line-height: 53px;
  font-size: 14px;
  text-align: center;
  font-weight: 700;
}
</style>

<div class="header">
    <div class="inner clearfix">
        <div class="fl">
            <a href="/" class="header-logo">
                <img
                    src="<?php echo C('UPYUN_DOMAIN'); echo C('SITE_TOPLOGO2');?>"
                    onerror="javascript:this.src='/Static/admin/images/error.png';"
                    ></a>
        </div>
        <!-- end logo -->

        <div class="header-nav fl">
            <ul class="header-nav-list clearfix">
                <!--<li class="fl <?php echo ($controller == 'index')?'active':'';?>"><a href="/admin">首页</a></li>-->
                <?php foreach($MENU as $k=>$v){?>
                <li class="fl <?php echo ($controller == $v['controller'])?'active':'';?>">
                    <a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
                </li>
                <?php } ?>
            </ul>
        </div>
        <!-- end header-nav -->

        <div class="fr">
            <ul class="header-ctrl clearfix">
                <li class="header-ctrl-item fl"><a href="/admin/login/logout">退出</a></li>
            </ul>
        </div>

        <span class="account_inbox_switch fr"></span>
        <span class="header-welcome fr">
            <a href="javasecript:;" class="tips" data-trigger="hover" data-placement="top"><?php echo $admininfo['username'];?></a>
        </span>

    </div>
</div>
<!-- end header -->
	<div class="container">
		<div class="inner clearfix">
	<div class="content-left fl">
    <?php foreach($SUBMENU as $subkey=>$sub){ ?>
    <dl class="left-menu shop_8">
        <dt>
            <i class="icon-menu home"></i> <span id="shop_0" data-id="0"><?=$sub['title']?></span>
        </dt>
        <?php foreach($sub['menu'] as $menu){ ?>
        <dd class="<?php echo ($action == $menu["action"])?'active':'';?>">
            <a href="<?=$menu['url']?>"><?=$menu['title']?></a>
        </dd>
        <?php } ?>
    </dl>
    <?php } ?>
</div>
<style>
.green{
	color:#25c401;
	font-size:16px;
}
.red{
	color:#e1321c;
}
.gray{
	color:#a0a0a0;
}
</style>
<div class="content-right fl">


	<h1 class="content-right-title">
	</h1>


	<!-- <a href="/admin/add" class="btn btn-success">发布商品</a>-->

	<form action="" method="get">
		<div class="tables-searchbox newcearchbox">
		

			<select name="gtype_id" class="select small newselect">
				<option value="" selected="">所有分类</option>
				<?php foreach($gtype as $k=>$v){ ?>
				<option value="<?php echo $v['gtype_id'];?>"  <?php echo $v['gtype_id']==get('gtype_id')?"selected":"";?>><?php echo $v['gtype_name'];?></option>
				<?php } ?>
			</select>

			
			<input type="text" placeholder="输入商品名称" class="input" name="goods_name" value="<?php echo get('goods_name');?>">
			<button class="btn btn-primary" style="line-height: 26px;">
				<i class="gicon-search white"></i>查询
			</button>
			<a href="/admin/goods/index" class="btn btn-primary vtal-2">清除查询</a>
		</div>
		<div class="tabs clearfix mgt10">
			<a href="/admin/goods/index" class="<?php echo ($action=="index")?"active":'';?> tabs_a fl">全部(<?php echo $goods_count[0];?>)</a>
			<a href="/admin/goods/onsale" class="<?php echo ($action=="onsale")?"active":'';?> tabs_a fl">出售中(<?php echo $goods_count[1];?>)</a>
			<a href="/admin/goods/onsku" class=" <?php echo ($action=="onsku")?"active":'';?> tabs_a fl">仓库中(<?php echo $goods_count[3];?>)</a>
			<a href="/admin/goods/outstock" class="<?php echo ($action=="outstock")?"active":'';?> tabs_a fl">已售罄(<?php echo $goods_count[2];?>)</a>
		</div>
	</form>
	<!-- end tabs -->

	<table class="wxtables mgt10">
		<colgroup>
			<col width="5%">
			<col width="7%">
			<col width="7%">
			<col width="7%">
			<col width="6%">
			<col width="6%">
			<col width="6%">
			<col width="6%">
			<col width="6%">
			<col width="33%">
		</colgroup>
		<thead>
			<tr class="po_list">
				<!--  <td><i class="icon_check"></i></td>-->
				<td>商品编号<span></span></td>
				<td>图片<span></span></td>
				<td>商品名称<span></span></td>
				<td>商品分类<span></span></td>
				<td>单价<span></span></td>
				<td>库存<span></span></td>
				<td>排序<span></span></td>
				<td>分佣<span></span></td>
				<td>状态<span></span></td>
				<td>操作<span></span></td>
			</tr>
		</thead>
		<tbody>
		
<?php foreach($datalist as $k=>$v){?>
		
			<tr>
				<!--  <td><input type="checkbox" class="checkbox table-ckbs" data-id="2416530"></td>-->
				<td><?php echo $v['goods_id'];?></td>
				<td><img src="<?php echo C("UPYUN_DOMAIN").$v['goods_pic'];?>"  width="60" height="60"  onerror="javascript:this.src='/Static//admin/images/error.png';">
				</td>
				<td><a href="javascript:chakan(<?php echo $v['goods_id'];?>);" class="block" target="_blank">
				<div class="table-item-info" style="width: 210px;">
				<p><?php echo $v['goods_name'];?></p>
				</div>
				</a>
				</td>
				<td><?php echo ($v['gtype_id']) ? ($gtype[$v['gtype_id']]['gtype_name'] ? $gtype[$v['gtype_id']]['gtype_name'] : '未分类') : "未分类";?></td>
				<td><?php echo $v['shop_price'];?></td>
				<td><?php echo $v['stock'];?></td>
				<td><?php echo $v['ord'];?></td>
				<td>
				
				<?php if($v['is_tejia']){ ?>
					<span class='red iconfont icon-cha'></span>
				<?php }else{ ?>
					<?php echo $v['is_fx_commission'] ? "<span class='green'>佣</span>":"<span class='red iconfont icon-cha'></span>";?>
				<?php } ?>
				
				
				</td>
				
				
				<td><?php echo $v['ischeck'] ? "<span class='green'>售</span>":"<span class='red'>已下架</span>";?></td>
				
				<td>
				
			<a href="javascript:chakan(<?php echo $v['goods_id'];?>);" class="btn width btn-small" title="修改">预览</a> 
			
			<a href="/admin/goods/edit/?goods_id=<?php echo $v['goods_id'];?>" class="btn width btn-primary btn-small" title="修改">编辑</a>
			
			<a href="/admin/goods/editdetail/?goods_id=<?php echo $v['goods_id'];?>" class="btn width btn-primary btn-small" title="编辑详情">编辑详情</a>
			
			<a href="javascript:del('<?php echo $v['goods_id'];?>');" class="btn j-del btn-danger  btn-small" title="删除">删除</a>

					</td>
			</tr>
			
<?php } ?>

		</tbody>

	</table>
	<div class="tables-btmctrl clearfix">
           <div class="mgt10">
               <div class="paginate">
                  <?php echo ($page); ?>
               </div>
           </div>
	</div>
</div>

<script>
function del(id){
	//询问框
	layer.confirm('你确定要删除该商品吗？', {
	    btn: ['确定','我再想想'] //按钮
	}, function(){
		var url = "/admin/goods/del/?id="+id;
		AjaxUrl(url);
	}, function(){
	});
}

function chakan(id){
	var url = '/mobile/article/qrcodeapi?url=<?php echo get_domain();?>/mobile/goods/index/?goods_id='+id;
	//在这里面输入任何合法的js语句
	layer.open({
	  type: 1, //page层
	  area: ['400px', '400px'],
	  title: '拿出手机,扫描我吧',
	  shade: 0.6, //遮罩透明度
	  moveType: 1, //拖拽风格，0是默认，1是传统拖动
	  shift: 3, //0-6的动画形式，-1不开启
	  shadeClose:true,
	  content: '<div style="padding:15px 50px;"><img src="'+url+'"  width="300" height="300" ></div>'
	});        
}
</script>
		</div>
	</div>
<!--gonggao-->
<div class="footer">&copy; <?php echo date("Y");?> <?php echo C("SITE_NAME");?> , Inc. All rights reserved.</div>
<a href="#" id="j-gotop" class="gotop" title="回到顶部" style="right:45px; display: inline;"></a>
<script type="text/javascript">
$(function(){
    var height1=$(".content-right").height();
    var height2=$(".content-left").height();
    if(parseInt(height1) < parseInt(height2)){
        $(".content-right").css({'min-height': height2});
    }
    $(window).scroll(function() {
		$(this).scrollTop() >= 150 ? $("#j-gotop").fadeIn(300) : $("#j-gotop").fadeOut(300)
	});
});
</script>
</body>
</html>